package Twice.day05.homework2.dao.impl;

import Twice.day05.homework2.dao.IPersonDao;
import Twice.day05.homework2.entity.Person;

/**
 * @Author: lya
 * @Description: 本类的作用描述:
 * @CreateDate: 2019/8/27
 * @Version: 1.0
 */
public class PersonDaoImpl implements IPersonDao{
    @Override
    public String match(Person p1, Person p2) {
        if(!p1.isMarry() && !p2.isMarry()){
            if(p1.getGender() != p2.getGender()){
                if ((p1.getGender() == 1 && p1.getAge() >= 24) && (p2.getGender() == 0 && p2.getAge() >= 22)){
                    return "可以结婚";
                }else{
                    return "不可以早婚";
                }
            }else{
                return "同性不能结婚";
            }
        }else{
            return "其中有人已经已婚";
        }
    }
}
